import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import * as directives from '@/directives' // 批量注册
import { imgerror, color } from '@/directives' // 按需注册
import '@/icons' // icon
import '@/permission' // permission control
import request from '@/utils/request'
import Print from 'vue-print-nb'// 注册打印插件

import * as filters from '@/filters' // 引入工具类
// import pageTools from '@/components/pageTools'
// Vue.component('pageTools', pageTools)
import myComponents from '@/components/mycomponents'

Vue.prototype.$request = request
Vue.use(myComponents)
Vue.use(Print)
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.config.productionTip = false
// 按需注册
// Vue.directive('imgerror', imgerror)
// 批量注册
Object.keys(directives).forEach(key => {
  Vue.directive(key, directives[key])
})
// 注册全局的过滤器
Object.keys(filters).forEach(key => {
  // 注册过滤器
  Vue.filter(key, filters[key])
})
Vue.directive('imgerror', imgerror)
Vue.directive('color', color)
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
